package org.apache.cxf.examples.impl;

import java.util.GregorianCalendar;

import org.apache.cxf.examples.Application;
import org.apache.cxf.examples.ApplicationId;
import org.apache.cxf.examples.ApplicationService;
import org.apache.cxf.examples.LoginResult;
import org.apache.cxf.examples.Title;

import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;

public class ApplicationServiceImpl implements ApplicationService {

	public LoginResult login(String username, String password) {
		return LoginResult.valueOf(password);
	}

	
	public Application getApplication(ApplicationId id) {
		Application app = new Application();
		app.setId(id);
		app.setFirstname("First");
		app.setLastname("Last");
		final GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();
		final XMLGregorianCalendarImpl xmlCal = new XMLGregorianCalendarImpl(cal);
		app.setDob(xmlCal);
		app.setTitle(Title.MR);
		return app;
	}

}
